package com.athuiju.hr.controller;


import com.athuiju.commonutils.R;
import com.athuiju.hr.entity.Position;
import com.athuiju.hr.service.PositionService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wzh
 * @since 2021-12-15
 */
@RestController
@Api(value="职位列表controller",tags={"职位列表操作接口"})
@RequestMapping("/hr/position")
public class PositionController {
    @Autowired
    private PositionService positionService;

    @ApiOperation(value = "所有职位列表")
    @GetMapping("list")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = Position.class),
    })
    public R list(){
        List<Position> positionList=positionService.list(null);
        return R.ok().data("positionList",positionList);
    }




    @ApiOperation(value = "根据id查询职位信息")
    @GetMapping("getPositionInfo/{sectorId}")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = Position.class),
    })
    public R getPositionInfo(@ApiParam(name = "id",value = "部门id",required = true)
                                 @PathVariable String sectorId){
       List<Position> list=positionService.getById(sectorId);
        return  R.ok().data("items",list);
    }


}

